import React from 'react'
import { useNavigate } from 'react-router-dom'

export default function Index() {
  const navigate = useNavigate()
  function goForward() { navigate(1) }
  function goBack() { navigate(-1) }
  return (
    <div className="row">
      <div className="col-xs-offset-2 col-xs-8">
        <div className="page-header">
          <button onClick={goForward}>前进</button>
          <button onClick={goBack}>后退</button>
          <h2>React Router Demo</h2></div>
      </div>
    </div>
  )

}
